home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 11 - 1995 / 11.04 Apr 95 / TreeAppƒ / Eric's C++ Libraries / Interface Classes / CPPVisualTree.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-04  |  2.6 KB  |  96 lines  |  [TEXT/KAHL]

  1. /***************************************************** IMPLEMENTATION
  2.     DATE:    10/24/93
  3.     AUTHOR: Eric R. Rosé
  4.  
  5.     CLASS:  CPPVisualTree
  6.     
  7.     SUPERCLASS: CPPTree
  8.     
  9.         This C++ class handles the display of a tree
  10.     
  11. ********************************************************************/
  12.  
  13. #pragma once
  14.  
  15. #include <CPPTree.h>
  16. #include <CPPVisualTreeNode.h>
  17.  
  18. class CPPVisualTreeNode;
  19.  
  20. class CPPVisualTree : public CPPTree {
  21. public:
  22.     CPPObject    *lastClicked;
  23.     Boolean        forceDraw;
  24.     
  25.                 CPPVisualTree (WindowPtr itsWindow, 
  26.                                Point     newTopLeft,
  27.                                orientStyle orientation = kTopDown,
  28.                                justStyle justification = kJustCenter,
  29.                                joinTypes join = kRightAngle,
  30.                                short branchLength = 25);
  31.                 ~CPPVisualTree (void);
  32.     
  33.     virtual    Boolean    Member (char *className);
  34.     virtual    char *ClassName (void);
  35.     
  36.             void    Prepare (CPPObject *caller);
  37.             void    Restore (CPPObject *caller);
  38.             
  39.             void    ForceRedraw (Boolean doErase);
  40.             void    ForceResize (Boolean doDraw);
  41.             void    DrawAllJoins (Boolean doDraw);
  42.             void    ForceMove (Boolean doDraw, Point topLeft);
  43.             void    AdjustTree (void);
  44.     
  45.             void    DrawDefaultJoin (CPPVisualTreeNode *FromNode, 
  46.                                      CPPVisualTreeNode *ToNode);
  47.  
  48.             void    SetOrientation (orientStyle newOrient);
  49.             void    SetJustification (justStyle newJust);
  50.             void    SetJoinType (joinTypes newJoin);
  51.             void    SetBranchLength (short newLength);
  52.             void    SetNodeMargin (short newMargin);
  53.  
  54.     inline    orientStyle    GetOrientation (void) { return this->orientation;}
  55.     inline     justStyle    GetJustification (void) { return this->justification;}
  56.     inline     joinTypes    GetJoinType (void) { return this->whichJoin;}
  57.     inline     short        GetBranchLength (void) { return this->branchLength;}
  58.     inline    short        GetNodeMargin (void) { return this->nodeMargin;}
  59.     
  60.     virtual    void    Draw (void);
  61.  
  62.     virtual    Boolean    DoCommand (short commandID);
  63.  
  64.     virtual    Boolean    DoTreeClick (EventRecord *theEvent);
  65.     virtual    void    DoCut (void);
  66.     virtual    void    DoCopy (void);
  67.     virtual    void    DoPaste (void);
  68.     virtual    void    DoClear (void);
  69.     virtual    void    DoSelectAll (void);
  70.  
  71.             void    GetTreeBounds (Rect *itsBounds);
  72.             PicHandle    GetTreePicture (Boolean asQDPICT, Boolean placeInClipboard);
  73.         
  74. protected:
  75.     WindowPtr    theWindow;
  76.     Point        topLeft;
  77.     
  78.     Boolean        isPrepared;
  79.     CPPObject     *preparedBy;
  80.     GrafPtr        SavePort;
  81.  
  82.     long        lastClickTime;
  83.         
  84.     orientStyle    orientation;
  85.     justStyle    justification;
  86.     joinTypes    whichJoin;
  87.     short        branchLength;
  88.     short        nodeMargin;
  89.  
  90.     virtual    void    UserSpecificPrepare (void);
  91.     virtual    void    UserSpecificRestore (void);
  92.     virtual    void    DrawPoint2Point (Point FromPt, Point ToPt);
  93.     virtual    void    DrawRightAngle (Point FromPt, Point ToPt, 
  94.                                     orientStyle orientation);
  95.  
  96. };